﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Ext.Net;
using System.IO;
namespace BitPortal.Admin.Tools.HtmlEditor
{
    public partial class Default : Controls.BaseAdminPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtFileName.Text.Length < 1)
                {
                    throw new Exception("Tên file ko hợp lệ!");
                }
                string path = Server.MapPath("~/Admin/Tools/HtmlEditor/" + txtFileName.Text + ".html");
                StreamWriter stream = new StreamWriter(path);
                stream.Write(HttpUtility.HtmlEncode(FCKeditor1.Value));
                stream.Flush();
                stream.Close();
                ShowNotification("Lưu thành công!");
            }
            catch (Exception ex)
            {
                ShowMessage(ex.Message);
            }
        }
    }
}